package com.bosch.in.rtp1.ept.action.form;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts.action.ActionForm;

import com.bosch.in.rtp1.ept.constant.SkippedRecipeConstanst;
import com.bosch.in.rtp1.ept.model.dto.SelectingInt;

/**
 * Class is used to store parameters which are conditions to set the duration color setting
 * @author TPR1HC
 *
 */

public class DurationColorConditionForm extends ActionForm{
	
	private static final long serialVersionUID = 1L;
	
	private float redDuration;
	private float yellowDuration;
	
	private List<SelectingInt> redDurationOperators;
	private List<SelectingInt> yellowDurationOperators;
	
	private int redDurationOp;
	private int yellowDurationOp;
	
	public float getRedDuration() {
		return redDuration;
	}

	public void setRedDuration(float redDuration) {
		this.redDuration = redDuration;
	}

	public float getYellowDuration() {
		return yellowDuration;
	}

	public void setYellowDuration(float yellowDuration) {
		this.yellowDuration = yellowDuration;
	}

	public List<SelectingInt> getRedDurationOperators() {
		 if (this.redDurationOperators == null) {
			this.redDurationOperators = this.buildOperators();
		 }
		return redDurationOperators;
	}

	public void setRedDurationOperators(List<SelectingInt> redDurationOperators) {
		this.redDurationOperators = redDurationOperators;
	}

	public List<SelectingInt> getYellowDurationOperators() {
		if (this.yellowDurationOperators == null) {
			this.yellowDurationOperators = this.buildOperators();
		}
		return yellowDurationOperators;
	}

	public void setYellowDurationOperators(
			List<SelectingInt> yellowDurationOperators) {
		this.yellowDurationOperators = yellowDurationOperators;
	}

	private List<SelectingInt> buildOperators()
	{
		List<SelectingInt> operators = new ArrayList<SelectingInt>();
		for (int i = 0; i< SkippedRecipeConstanst.NUM_OP_OPERATOR ; ++i)
		{
			SelectingInt selectingInt = new SelectingInt();
			selectingInt.setDisplay(SkippedRecipeConstanst.OPERATORS[i]);
			selectingInt.setValue(i);
			operators.add(selectingInt);
		}
		return operators;
	}

	public int getRedDurationOp() {
		return redDurationOp;
	}

	public void setRedDurationOp(int redDurationOp) {
		this.redDurationOp = redDurationOp;
	}

	public int getYellowDurationOp() {
		return yellowDurationOp;
	}

	public void setYellowDurationOp(int yellowDurationOp) {
		this.yellowDurationOp = yellowDurationOp;
	}
	
	
}
